require 'rake/clean'

DOT_NET_PATH = "#{ENV["SystemRoot"]}\\Microsoft.NET\\Framework\\v3.5"
NUNIT_EXE = "lib/Nunit/nunit-console.exe"
OUTPUT_PATH = "output"
CONFIG = "Debug"
 
CLEAN.include(OUTPUT_PATH)
directory "#{OUTPUT_PATH}/test"

task :default => :build
task :build => [:clean, :compile, :test] 

task :compile do  
  sh "#{DOT_NET_PATH}/msbuild.exe /t:Rebuild /nologo /v:m /p:Configuration=#{CONFIG} yab.sln"
end

task :test => [ "#{OUTPUT_PATH}/test"] do 
  testdll = "yab.Tests/bin/#{CONFIG}/yab.Tests.dll"  
  outputfile = "#{OUTPUT_PATH}/test/testresults.xml"
  sh "#{NUNIT_EXE} #{testdll} /xml=#{outputfile}"
end

